﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WinFormsAppTest.pojo;

namespace WinFormsAppTest.Service
{
    internal class DataGridViewClass
    {
        //通过id在user表中搜索
        public DataGridView GetUserDataById(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            AdminService adminservice = new AdminService();

            List<WinFormsAppTest.pojo.User> users = new List<WinFormsAppTest.pojo.User>();
            users = adminservice.GetUserById(id);

            int _i = users.Count - 1;
            if (users.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < users.Count; j++)
            {
                WinFormsAppTest.pojo.User f = users[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UserNameColumn"].Value = f.Name;
                table.Rows[myNewRowIndex].Cells["PasswordColumn"].Value = f.Password;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }

        //通过id在admin表中搜索
        public DataGridView GetAdminDataById(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            AdminService adminservice = new AdminService();

            List<WinFormsAppTest.pojo.Admin> users = new List<WinFormsAppTest.pojo.Admin>();
            users = adminservice.GetAdminById(id);

            int _i = users.Count - 1;
            if (users.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < users.Count; j++)
            {
                WinFormsAppTest.pojo.Admin f = users[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["AdminIdColumn"].Value = f.Adminid;
                table.Rows[myNewRowIndex].Cells["AdminNameColumn"].Value = f.Name;
                table.Rows[myNewRowIndex].Cells["PasswordColumn"].Value = f.Password;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }


        //通过用户id在files表中搜索
        public DataGridView GetFilesDataByUserId(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            FilesService fileservice = new FilesService();

            List<WinFormsAppTest.Class.Files> files = new List<WinFormsAppTest.Class.Files>();
            files = fileservice.GetFilesByUserId(id);

            int _i = files.Count - 1;
            if (files.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < files.Count; j++)
            {
                WinFormsAppTest.Class.Files f = files[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["FileIdColumn"].Value = f.fileid;
                table.Rows[myNewRowIndex].Cells["MsgColumn"].Value = f.msg;
                table.Rows[myNewRowIndex].Cells["HouseColumn"].Value = f.house;
                table.Rows[myNewRowIndex].Cells["ContractColumn"].Value = f.contract;
                table.Rows[myNewRowIndex].Cells["InsureColumn"].Value = f.insure;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }

        //通过档案id在files表中搜索
        public DataGridView GetFilesDataById(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            FilesService fileservice = new FilesService();

            List<WinFormsAppTest.Class.Files> files = new List<WinFormsAppTest.Class.Files>();
            files = fileservice.GetFilesById(id);

            int _i = files.Count - 1;
            if (files.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < files.Count; j++)
            {
                WinFormsAppTest.Class.Files f = files[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["FileIdColumn"].Value = f.fileid;
                table.Rows[myNewRowIndex].Cells["MsgColumn"].Value = f.msg;
                table.Rows[myNewRowIndex].Cells["HouseColumn"].Value = f.house;
                table.Rows[myNewRowIndex].Cells["ContractColumn"].Value = f.contract;
                table.Rows[myNewRowIndex].Cells["InsureColumn"].Value = f.insure;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }


        //根据变动id查询全部人事变动
        public DataGridView GetChangeDataById(DataGridView table,int id)
        {
            table.Rows.Clear();
            //开始添加数据
            ChangeService changeservice = new ChangeService();

            List<Change> change = new List<Change>();
            change = changeservice.GetChangeById(id);

            int _i = change.Count - 1;
            if (change.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < change.Count; j++)
            {
                Change f = change[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["ChangeIdColumn"].Value = f.Changeid;
                table.Rows[myNewRowIndex].Cells["TypeColumn"].Value = f.Type;
                table.Rows[myNewRowIndex].Cells["TimeColumn"].Value = f.Time;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //

        //根据员工id查询全部人事变动
        public DataGridView GetChangeDataByUserId(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            ChangeService changeservice = new ChangeService();

            List<Change> change = new List<Change>();
            change = changeservice.GetChangeByUserId(id);

            int _i = change.Count - 1;
            if (change.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < change.Count; j++)
            {
                Change f = change[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["ChangeIdColumn"].Value = f.Changeid;
                table.Rows[myNewRowIndex].Cells["TypeColumn"].Value = f.Type;
                table.Rows[myNewRowIndex].Cells["TimeColumn"].Value = f.Time;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据考核id查找全部考核奖惩
        public DataGridView GetExamDataById(DataGridView table,int id)
        {
            table.Rows.Clear();
            //开始添加数据
            ExamService examservice = new ExamService();

            List<Exam> exam = new List<Exam>();
            exam = examservice.GetExamById(id);

            int _i = exam.Count - 1;
            if (exam.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < exam.Count; j++)
            {
                Exam f = exam[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["ExamIdColumn"].Value = f.Examid;
                table.Rows[myNewRowIndex].Cells["StateColumn"].Value = f.State;
                table.Rows[myNewRowIndex].Cells["MeasureColumn"].Value = f.Measure;
                table.Rows[myNewRowIndex].Cells["GoalColumn"].Value = f.Goal;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据考核id查找全部考核奖惩
        public DataGridView GetExamDataByUserId(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            ExamService examservice = new ExamService();

            List<Exam> exam = new List<Exam>();
            exam = examservice.GetExamByUserId(id);

            int _i = exam.Count - 1;
            if (exam.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < exam.Count; j++)
            {
                Exam f = exam[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["ExamIdColumn"].Value = f.Examid;
                table.Rows[myNewRowIndex].Cells["StateColumn"].Value = f.State;
                table.Rows[myNewRowIndex].Cells["MeasureColumn"].Value = f.Measure;
                table.Rows[myNewRowIndex].Cells["GoalColumn"].Value = f.Goal;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据出差id查找全部出差信息
        public DataGridView GetOuttimeDataById(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            OuttimeService examservice = new OuttimeService();

            List<Outtime> outtime = new List<Outtime>();
            outtime = examservice.GetOuttimeById(id);

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Outtime f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Outid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["PlaceColumn"].Value = f.Place;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据用户id查找全部出差信息
        public DataGridView GetOuttimeDataByUserId(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            OuttimeService examservice = new OuttimeService();

            List<Outtime> outtime = new List<Outtime>();
            outtime = examservice.GetOuttimeByUserId(id);

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Outtime f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Outid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["PlaceColumn"].Value = f.Place;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据签到id查找全部签到信息
        public DataGridView GetSignsDataById(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            SignsService examservice = new SignsService();

            List<Signs> outtime = new List<Signs>();
            outtime = examservice.GetSignsById(id);

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Signs f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Signid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据用户id查找全部签到信息
        public DataGridView GetSignsDataByUserId(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            SignsService examservice = new SignsService();

            List<Signs> outtime = new List<Signs>();
            outtime = examservice.GetSignsByUserId(id);

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Signs f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Signid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据加班id查找全部签到信息
        public DataGridView GetOvertimeDataById(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            OvertimeService examservice = new OvertimeService();

            List<Overtime> outtime = new List<Overtime>();
            outtime = examservice.GetOvertimeById(id);

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Overtime f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Overid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据用户id查找全部签到信息
        public DataGridView GetOvertimeDataByUserId(DataGridView table, int id)
        {
            table.Rows.Clear();
            //开始添加数据
            OvertimeService examservice = new OvertimeService();

            List<Overtime> outtime = new List<Overtime>();
            outtime = examservice.GetOvertimeByUserId(id);

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Overtime f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Overid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //

        //------------------------ 根据id 查询   结束 -----------------------//







        //------------------------ 刷新整个表    开始 ----------------------//
        public DataGridView GetUsersData(DataGridView table)
        {
            table.Rows.Clear();
            //开始添加表格中的数据
            AdminService adminservice = new AdminService();

            List<WinFormsAppTest.pojo.User> users = new List<WinFormsAppTest.pojo.User>();
            users = adminservice.GetUsers();

            int _i = users.Count - 1;
            if (users.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }
            //升序版
            for (int j = 0; j < users.Count; j++)
            {
                pojo.User f = users[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UserNameColumn"].Value = f.Name;
                table.Rows[myNewRowIndex].Cells["PasswordColumn"].Value = f.Password;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }


        public DataGridView GetAdminsData(DataGridView table)
        {
            table.Rows.Clear();
            //开始添加表格中的数据
            AdminService adminservice = new AdminService();

            List<WinFormsAppTest.pojo.Admin> users = new List<WinFormsAppTest.pojo.Admin>();
            users = adminservice.GetAdmins();

            int _i = users.Count - 1;
            if (users.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }
            //升序版
            for (int j = 0; j < users.Count; j++)
            {
                pojo.Admin f = users[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["AdminIdColumn"].Value = f.Adminid;
                table.Rows[myNewRowIndex].Cells["AdminNameColumn"].Value = f.Name;
                table.Rows[myNewRowIndex].Cells["PasswordColumn"].Value = f.Password;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }


        //查找全部档案
        public DataGridView GetFilesData(DataGridView table)
        {
            table.Rows.Clear();
            //开始添加数据
            FilesService fileservice = new FilesService();

            List<WinFormsAppTest.Class.Files> files = new List<WinFormsAppTest.Class.Files>();
            files = fileservice.GetFiles();

            int _i = files.Count - 1;
            if (files.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < files.Count; j++)
            {
                WinFormsAppTest.Class.Files f = files[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["FileIdColumn"].Value = f.fileid;
                table.Rows[myNewRowIndex].Cells["MsgColumn"].Value = f.msg;
                table.Rows[myNewRowIndex].Cells["HouseColumn"].Value = f.house;
                table.Rows[myNewRowIndex].Cells["ContractColumn"].Value = f.contract;
                table.Rows[myNewRowIndex].Cells["InsureColumn"].Value = f.insure;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //查找全部人事变动
        public DataGridView GetChangesData(DataGridView table)
        {
            table.Rows.Clear();
            //开始添加数据
            ChangeService changeservice = new ChangeService();

            List<Change> change = new List<Change>();
            change = changeservice.GetChanges();

            int _i = change.Count - 1;
            if (change.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < change.Count; j++)
            {
                Change f = change[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["ChangeIdColumn"].Value = f.Changeid;
                table.Rows[myNewRowIndex].Cells["TypeColumn"].Value = f.Type;
                table.Rows[myNewRowIndex].Cells["TimeColumn"].Value = f.Time;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //查找全部考核奖惩
        public DataGridView GetExamData(DataGridView table)
        {
            table.Rows.Clear();
            //开始添加数据
            ExamService examservice = new ExamService();

            List<Exam> exam = new List<Exam>();
            exam = examservice.GetExams();

            int _i = exam.Count - 1;
            if (exam.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < exam.Count; j++)
            {
                Exam f = exam[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["ExamIdColumn"].Value = f.Examid;
                table.Rows[myNewRowIndex].Cells["StateColumn"].Value = f.State;
                table.Rows[myNewRowIndex].Cells["MeasureColumn"].Value = f.Measure;
                table.Rows[myNewRowIndex].Cells["GoalColumn"].Value = f.Goal;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //全部出差信息
        public DataGridView GetOuttimesData(DataGridView table)
        {
            table.Rows.Clear();
            //开始添加数据
            OuttimeService examservice = new OuttimeService();

            List<Outtime> outtime = new List<Outtime>();
            outtime = examservice.GetOuttimes();

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Outtime f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Outid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["PlaceColumn"].Value = f.Place;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //全部签到信息
        public DataGridView GetSignssData(DataGridView table)
        {
            table.Rows.Clear();
            //开始添加数据
            SignsService examservice = new SignsService();

            List<Signs> outtime = new List<Signs>();
            outtime = examservice.GetSignss();

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Signs f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Signid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //全部加班信息
        public DataGridView GetOvertimesData(DataGridView table)
        {
            table.Rows.Clear();
            //开始添加数据
            OvertimeService examservice = new OvertimeService();

            List<Overtime> outtime = new List<Overtime>();
            outtime = examservice.GetOvertimes();

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Overtime f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Overid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //------------------------ 刷新整个表    结束 ----------------------//





        //------------------------ 根据表中其他属性进行查找    开始 ----------------------//
        //根据用户名查找
        public DataGridView GetUserDataByName(DataGridView table, string name)
        {
            table.Rows.Clear();
            //开始添加数据
            AdminService adminservice = new AdminService();

            List<WinFormsAppTest.pojo.User> users = new List<WinFormsAppTest.pojo.User>();
            users = adminservice.GetUserByName(name);

            int _i = users.Count - 1;
            if (users.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < users.Count; j++)
            {
                WinFormsAppTest.pojo.User f = users[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UserNameColumn"].Value = f.Name;
                table.Rows[myNewRowIndex].Cells["PasswordColumn"].Value = f.Password;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }

        //根据管理员名查找
        public DataGridView GetAdminDataByName(DataGridView table, string name)
        {
            table.Rows.Clear();
            //开始添加数据
            AdminService adminservice = new AdminService();

            List<WinFormsAppTest.pojo.Admin> users = new List<WinFormsAppTest.pojo.Admin>();
            users = adminservice.GetAdminByName(name);

            int _i = users.Count - 1;
            if (users.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < users.Count; j++)
            {
                WinFormsAppTest.pojo.Admin f = users[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["AdminIdColumn"].Value = f.Adminid;
                table.Rows[myNewRowIndex].Cells["AdminNameColumn"].Value = f.Name;
                table.Rows[myNewRowIndex].Cells["PasswordColumn"].Value = f.Password;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据档案的户口情况查找
        public DataGridView GetFilesDataByHouse(DataGridView table, string house)
        {
            table.Rows.Clear();
            //开始添加数据
            FilesService fileservice = new FilesService();

            List<WinFormsAppTest.Class.Files> files = new List<WinFormsAppTest.Class.Files>();
            files = fileservice.GetFilesByHouse(house);

            int _i = files.Count - 1;
            if (files.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < files.Count; j++)
            {
                WinFormsAppTest.Class.Files f = files[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["FileIdColumn"].Value = f.fileid;
                table.Rows[myNewRowIndex].Cells["MsgColumn"].Value = f.msg;
                table.Rows[myNewRowIndex].Cells["HouseColumn"].Value = f.house;
                table.Rows[myNewRowIndex].Cells["ContractColumn"].Value = f.contract;
                table.Rows[myNewRowIndex].Cells["InsureColumn"].Value = f.insure;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据员工id查询全部人事变动
        public DataGridView GetChangeDataByType(DataGridView table, string type)
        {
            table.Rows.Clear();
            //开始添加数据
            ChangeService changeservice = new ChangeService();

            List<Change> change = new List<Change>();
            change = changeservice.GetChangeByType(type);

            int _i = change.Count - 1;
            if (change.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < change.Count; j++)
            {
                Change f = change[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["ChangeIdColumn"].Value = f.Changeid;
                table.Rows[myNewRowIndex].Cells["TypeColumn"].Value = f.Type;
                table.Rows[myNewRowIndex].Cells["TimeColumn"].Value = f.Time;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据考核情况查找全部考核奖惩
        public DataGridView GetExamDataByState(DataGridView table,string state)
        {
            table.Rows.Clear();
            //开始添加数据
            ExamService examservice = new ExamService();

            List<Exam> exam = new List<Exam>();
            exam = examservice.GetExamByState(state);

            int _i = exam.Count - 1;
            if (exam.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < exam.Count; j++)
            {
                Exam f = exam[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["ExamIdColumn"].Value = f.Examid;
                table.Rows[myNewRowIndex].Cells["StateColumn"].Value = f.State;
                table.Rows[myNewRowIndex].Cells["MeasureColumn"].Value = f.Measure;
                table.Rows[myNewRowIndex].Cells["GoalColumn"].Value = f.Goal;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //

        //根据出差地点全部出差信息
        public DataGridView GetOuttimeDataByPlace(DataGridView table,string place)
        {
            table.Rows.Clear();
            //开始添加数据
            OuttimeService examservice = new OuttimeService();

            List<Outtime> outtime = new List<Outtime>();
            outtime = examservice.GetOuttimeByPlace(place);

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Outtime f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Outid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["PlaceColumn"].Value = f.Place;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //



        //根据签到时间查找签到信息
        public DataGridView GetSignsDataByTime(DataGridView table,DateTime begintime)
        {
            table.Rows.Clear();
            //开始添加数据
            SignsService examservice = new SignsService();

            List<Signs> outtime = new List<Signs>();
            outtime = examservice.GetSignsByTime(begintime);

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Signs f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Signid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //


        //根据签到时间查找签到信息
        public DataGridView GetOvertimeDataByTime(DataGridView table, DateTime begintime)
        {
            table.Rows.Clear();
            //开始添加数据
            OvertimeService examservice = new OvertimeService();

            List<Overtime> outtime = new List<Overtime>();
            outtime = examservice.GetOvertimeByTime(begintime);

            int _i = outtime.Count - 1;
            if (outtime.Count == 0)
            {
                MessageBox.Show("用户信息无法查询!");
                return table;
            }

            for (int j = 0; j < outtime.Count; j++)
            {
                Overtime f = outtime[j];
                int myNewRowIndex = table.Rows.Add();
                table.Rows[myNewRowIndex].Cells["OutIdColumn"].Value = f.Overid;
                table.Rows[myNewRowIndex].Cells["BeginTimeColumn"].Value = f.Begintime;
                table.Rows[myNewRowIndex].Cells["EndTimeColumn"].Value = f.Endtime;
                table.Rows[myNewRowIndex].Cells["WorkIdColumn"].Value = f.Workid;
                table.Rows[myNewRowIndex].Cells["UserIdColumn"].Value = f.Userid;
                table.Rows[myNewRowIndex].Cells["UpdateColumn"].Value = "更新";
                table.Rows[myNewRowIndex].Cells["DeleteColumn"].Value = "删除";
            }
            //
            return table;
        }
        //

        //------------------------ 根据表中其他属性进行查找    结束 ----------------------//

    }
}
